<template>
	<view class="container">

		<view class="shuzi u-m-t-20">


			<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType">
				<u-form-item class="u-m-l-30 u-m-r-40" :label-width="200" :label-position="labelPosition" label="项目名称" prop="ppsx">
					<u-input type="select" :select-open="selectShowPpsx" v-model="model.ppsx" placeholder="请选择" placeholderStyle="color: #0D1D36;"
					 input-align="right" @click="selectShowPpsx = true"></u-input>
				</u-form-item>
				<u-form-item class="u-m-l-30 u-m-r-30" label-width="200" :label-position="labelPosition" label="项目地点" prop="xmmc">
					<u-input :border="border" placeholder="请输入" v-model="model.xmmc" type="text" input-align="right"></u-input>
				</u-form-item>
				<u-form-item class="u-m-l-30 u-m-r-30" label-width="200" :label-position="labelPosition" label="进展阶段" prop="fbnr">
					<u-input :border="border" placeholder="请输入" v-model="model.fbnr" type="text" input-align="right"></u-input>
				</u-form-item>

				<u-form-item class="u-m-l-30 u-m-r-40" :label-width="200" :label-position="labelPosition" label="争议诉求" prop="ppsx">
					<u-input type="select" :select-open="selectShowPpsx" v-model="model.ppsx" placeholder="请选择" placeholderStyle="color: #0D1D36;"
					 input-align="right" @click="selectShowPpsx = true"></u-input>
				</u-form-item>



				<!-- 
				<u-gap :bg-color="bgColor" :height="height" :margin-bottom="marginBottom"></u-gap> -->
				<view class="qtsm u-m-l-40 u-m-r-30 u-m-t-40">
					<image src="../../static/img/releasesm.png" style="width: 29rpx; height: 29rpx;" mode=""></image>
					<text class="hz">争议说明</text>
				</view>
				<u-form-item class="  zwpj u-m-l-30 u-m-r-30 " :label-position="labelPosition" prop="zwpj">
					<u-input type="textarea" :border="border" placeholder="请详细描述争议说明" v-model="model.zwpj" />
				</u-form-item>
				<view class="qtsm u-m-l-40 u-m-r-30 u-m-t-40">
					<image src="../../static/img/releasesm.png" style="width: 29rpx; height: 29rpx;" mode=""></image>
					<text class="hz">其他说明</text>
				</view>
				<u-form-item class="  zwpj u-m-l-30 u-m-r-30 " :label-position="labelPosition" prop="zwpj">
					<u-input type="textarea" :border="border" placeholder="请描述其他说明" v-model="model.zwpj" />
				</u-form-item>
				<view class="qtsm u-m-l-40 u-m-r-30 u-m-t-40">
					<image src="../../static/img/releasesm.png" style="width: 29rpx; height: 29rpx;" mode=""></image>
					<text class="hz">上传图片</text>

				</view>
				<view class="u-p-30">
					<u-upload v-model="model.sczz" width="160"></u-upload>
				</view>

				<u-gap :bg-color="bgColor" :height="height" :margin-bottom="marginBottom"></u-gap>

				<view class="">
					<view class="u-m-r-30 u-m-l-30 u-flex u-row-start">
						<image src="../../static/img/releasesm.png" style="width: 29rpx; height: 29rpx;" mode=""></image>
						<view class="u-font-30 u-m-l-10">合同签订</view>

					</view>
					<view v-for="(item,index) in 1" :key="index" class="tdxy u-m-l-30 u-m-t-30">
						<view class="word u-m-l-30 u-p-t-30">
							<image src="../../static/img/word.png" mode=""></image>
							<text>合同协议.doc</text>
						</view>
						<view class="sctime u-m-l-30 u-p-t-30">
							<text class="scsj">上传时间:</text>
							<text class="sctime u-m-r-20">2020-06-01 16:24:18</text>
						</view>
					</view>
					<u-gap :bg-color="bgColor" :height="height" :margin-bottom="marginBottom" class="u-m-t-30"></u-gap>
					<view class="qtsm u-m-l-40 u-m-r-30 u-m-t-40">
						<image src="../../static/img/releasesm.png" style="width: 29rpx; height: 29rpx;" mode=""></image>
						<text class="hz">项目进度</text>
					</view>
					<view class="u-m-t-35 u-m-l-30">
						<view class="ty">
						</view>
					</view>
					<view class="u-m-l-30">
						<view class="xx">
						</view>
						<view class="youbian">
						<view class="u-flex u-row-between">
							<view class="xmjz u-m-l-30">召开会议</view>
							<view class="sctime u-m-r-30">2020-06-10</view>
						</view>
						<view class="sctime u-m-l-30 u-m-t-30">
							正式开启项目会议，了解项目工作内容
						</view>
						</view>
						
					</view>
						
					<view class="u-m-t-35 u-m-l-30">
						<view class="ty">
						</view>
					</view>
					<view class="u-m-l-30">
						<view class="xx">
						</view>
						<view class="youbian">
						<view class="u-flex u-row-between">
							<view class="xmjz u-m-l-30">项目初期</view>
							<view class="sctime u-m-r-30">2020-06-10</view>
						</view>
						<view class="sctime u-m-l-30 u-m-t-30">
							正式开启项目会议，了解项目工作内容
						</view>
						</view>
						
					</view>
					<view class="u-m-t-35 u-m-l-30">
						<view class="ty">
						</view>
					</view>
					<view class="u-m-l-30">
						<view class="xx">
						</view>
						<view class="youbian">
						<view class="u-flex u-row-between">
							<view class="xmjz u-m-l-30">项目中期</view>
							<view class="sctime u-m-r-30">2020-06-10</view>
						</view>
						<view class="sctime u-m-l-30 u-m-t-30">
							正式开启项目会议，了解项目工作内容
						</view>
						</view>
						
					</view>
					<view class="u-m-t-35 u-m-l-30">
						<view class="ty">
						</view>
					</view>
					<view class="u-m-l-30">
						<view class="xx">
						</view>
						<view class="youbian">
						<view class="u-flex u-row-between">
							<view class="xmjz u-m-l-30">项目收尾</view>
							<view class="sctime u-m-r-30">2020-06-10</view>
						</view>
						<view class="sctime u-m-l-30 u-m-t-30">
							正式开启项目会议，了解项目工作内容
						</view>
						</view>
					</view>
				
					
						
						
					
				</view>
			</u-form>
		</view>
		<view class="warp u-m-t-20 u-p-30">
			<u-button class="button" @click="submit">提交仲裁</u-button>
			<!--弹出框-->
			<u-select mode="single-column" :list="wsList" v-model="selectShowWs" @confirm="selectConfirmWs"></u-select>
			<u-select mode="single-column" :list="wxyList" v-model="selectShowWxy" @confirm="selectConfirmWxy"></u-select>
			<u-select mode="single-column" :list="wyxList" v-model="selectShowWyx" @confirm="selectConfirmWyx"></u-select>
			<u-select mode="single-column" :list="selectList" v-model="selectShowFbsx" @confirm="selectConfirmFbsx"></u-select>
			<u-picker mode="region" v-model="pickerShow" @confirm="regionConfirm"></u-picker>
			<!--弹出框-->
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			let that = this;
			return {
				height: 20,
				bgColor: this.$u.color.bgColor,
				marginTop: 30,
				marginBottom: 30,
				/**
				 * form验证
				 * */
				model: {
					ws: '',
					wxy: '',
					wyx: '',
					qymc: '',
					fbsx: '',
					xmmc: '',
					fbnr: '',
					region: '',
					ds: '',
				},
				selectList: [{
						value: '测试1',
						label: '测试1'
					},
					{
						value: '测试2',
						label: '测试2'
					},
					{
						value: '测试3',
						label: '测试3'
					}
				],
				wsList: [],
				wxyList: [],
				wyxList: [],
				rules: {
					zyp: [{
						required: false,
						message: '请选择招/应聘',
						trigger: 'change'
					}],
					// region: [
					// 	{
					// 		required: false,
					// 		message: '请选择地区',
					// 		trigger: 'change',
					// 	}
					// ],
					ws: [{
						required: false,
						message: '请选择我是',
						trigger: 'change'
					}],
					wxy: [{
						required: false,
						message: '请选择我需要',
						trigger: 'change'
					}],
					wyx: [{
						required: false,
						message: '请选择我意向',
						trigger: 'change'
					}]
				},
				reqBody: {},
				required: false,
				border: false,
				check: false,
				region: '',
				selectStatus: 'close',
				selectShowZyp: false,
				selectShowWs: false,
				selectShowWxy: false,
				selectShowWyx: false,
				selectShowFbsx: false,
				selectShowQydy: false,
				selectShowLyxy: false,
				pickerShow: false,
				labelPosition: 'left',
				codeTips: '',
				errorType: ['toast'],
				/**/

				/**
				 * 数字统计
				 * */
				startVal: 500,
				endVal: 500,
				separator: ',',
				decimals: 0,
				duration: 2000,
				autoplay: true,
				useEasing: true,
				current: 3,
				isStop: false,
				bold: false,
				fontSize: 24,
				color: '#fff',
				/**/
				keyIndex: 0,
				keywords: [{
					name: '企业',
					selected: true
				}, {
					name: '设计师',
					selected: false
				}, {
					name: '监理',
					selected: false
				}, {
					name: '大型企业',
					selected: false
				}, {
					name: '采购',
					selected: false
				}, {
					name: '监理',
					selected: false
				}]
			};
		},
		mounted() {},
		onShow() {
			this.wsDictionary();
			this.wxyDictionary();
			this.wyxDictionary();
		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		methods: {
			//新增项目
			async submit() {
				this.$refs.uForm.validate(valid => {
					if (valid) {
						console.log('验证通过');
						this.insertProject();
					} else {
						console.log('验证失败');
					}
				});

			},
			async insertProject() {
				try {
					this.reqBody['name'] = this.model['xmmc'];
					this.reqBody['status'] = 0;
					let data = await this.$apis.saveProject(this.reqBody);
					console.log(JSON.stringify(data));
					// uni.setStorageSync("userInfo",data);
					if (data.code == 200) {
						uni.showToast({
							title: "完善信息成功",
							icon: 'none'
						});
						setTimeout(() => {
							this.$mRouter.switchTab({
								route: this.$mRoutesConfig.message
							});
						}, 1000)
					} else {
						uni.showToast({
							title: result.msg,
							icon: 'none'
						});
						return;
					}
				} catch (e) {
					console.log(e);
					this.submitBtnDis = false;
				}
			},
			//查询匹配 我是  字典数据
			async wsDictionary() {
				let reqBody = {};
				reqBody['primary'] = "招投标";
				reqBody['secondary'] = "我是";
				let result = await this.$apis.findMatchingDictionary(reqBody);
				let list = result.data;
				for (let i = 0; i < list.length; i++) {
					let wsValue = {};
					wsValue['value'] = list[i].name;
					wsValue['label'] = list[i].name;
					this.wsList.push(wsValue)
				}
			},
			//查询匹配 我需要  字典数据
			async wxyDictionary() {
				let reqBody = {};
				reqBody['primary'] = "招投标";
				reqBody['secondary'] = "我需要";
				let result = await this.$apis.findMatchingDictionary(reqBody);
				let list = result.data;
				for (let i = 0; i < list.length; i++) {
					let wxyValue = {};
					wxyValue['value'] = list[i].name;
					wxyValue['label'] = list[i].name;
					this.wxyList.push(wxyValue)
				}
			},
			//查询匹配 我意向  字典数据
			async wyxDictionary() {
				let reqBody = {};
				reqBody['primary'] = "招投标";
				reqBody['secondary'] = "我意向";
				let result = await this.$apis.findMatchingDictionary(reqBody);
				let list = result.data;
				for (let i = 0; i < list.length; i++) {
					let wyxValue = {};
					wyxValue['value'] = list[i].name;
					wyxValue['label'] = list[i].name;
					this.wyxList.push(wyxValue)
				}
			},
			selectKey(e) {
				this.keywords[e].selected = !this.keywords[e].selected;
			},
			// 选择地区回调
			regionConfirm(e) {
				this.model.region = e.province.label + '-' + e.city.label + '-' + e.area.label;
			},
			// 选择
			selectConfirmWs(e) {
				this.model.ws = '';
				e.map((val, index) => {
					this.model.ws += this.model.ws == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmWxy(e) {
				this.model.wxy = '';
				e.map((val, index) => {
					this.model.wxy += this.model.wxy == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmWyx(e) {
				this.model.wyx = '';
				e.map((val, index) => {
					this.model.wyx += this.model.wyx == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmFbsx(e) {
				this.model.fbsx = '';
				e.map((val, index) => {
					this.model.fbsx += this.model.fbsx == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmQydy(e) {
				this.model.qydy = '';
				e.map((val, index) => {
					this.model.qydy += this.model.qydy == '' ? val.label : '-' + val.label;
				});
			}
		}
	};
</script>
<style scoped lang="scss">
	// page {
	// 	background: #f5f5f9;
	// }
	.youbian{
		// border: 1px solid;
		margin-top: -230rpx;
	}
	.xmjz {

		font-weight: bold;
		font-size: 32rpx;
	
		color: #B9BCC1;
	}

	.sctime {

		color: #888D99;
		font-size: 28rpx;
		// margin-left: 20rpx;
	}

	.ty {
		width: 18rpx;
		height: 18rpx;
		background: #ffffff;
		border-radius: 50%;
		border: 2rpx solid #c8b8c5;
		;
	}

	.xx {
		width: 2rpx;
		height: 200rpx;
		border: 2rpx dashed #888D99;
		opacity: 0.5;
		margin-left: 7rpx;
		margin-top: 8rpx;
	}

	.tdxy {
		width: 690rpx;
		height: 159rpx;
		background: #F5F5F9;
		border-radius: 20rpx;

		.word {
			display: flex;
			align-items: center;

			image {
				width: 41rpx;
				height: 37rpx;
			}

			text {
				color: #4B9CFF;
				font-size: 30rpx;
				margin-left: 16rpx;
			}
		}
	}


	.scxy {
		display: flex;
		align-items: center;
		width: 190rpx;
		height: 52rpx;
		border: 2rpx solid #AB61FF;
		border-radius: 26rpx;
		color: #AB61FF;
		font-size: 26rpx;

		image {
			width: 30rpx;
			height: 30rpx;
			margin-top: 5rpx;
			margin-left: 26rpx;
		}
	}

	.top {
		width: 100%;
		height: 350rpx;
		background: linear-gradient(0deg, #AB61FF, #DF61FF);

		.above {
			display: flex;
			justify-content: center;
			margin-left: -46rpx;

			.picture {
				width: 117.8rpx;
				height: 137.4rpx;
				margin-left: 46rpx;
				margin-top: 20rpx;
			}
		}

		.below {
			display: flex;
			justify-content: center;
			margin-left: -46rpx;

			.picture {
				width: 117.8rpx;
				height: 137.4rpx;
				margin-left: 46rpx;
				margin-top: 1rpx;
			}
		}
	}

	.count {
		margin-top: -50rpx;
		width: 100%;
		height: 100rpx;
		background: #FFFFFF;
		border-radius: 40rpx 40rpx 0rpx 0rpx;

		.count-to {
			font-size: 24rpx;
		}

		text {
			padding: 2rpx 12rpx;
			background: #ff9e21;
			color: #ffffff;
			font-size: 24rpx;
		}
	}

	.fgx {
		width: 100%;
		height: 20rpx;
		background-color: #F5F5F9;
		margin-top: 40rpx;
	}

	.fgx1 {
		width: 100%;
		height: 20rpx;
		background-color: #F5F5F9;
	}

	.group {
		padding: 6rpx 21rpx;
		background: #f1f7ff;
		border-radius: 6rpx;
		margin: 30rpx 30rpx 0 30rpx;
	}

	.button {
		width: 662rpx;
		margin: 148rpx auto 45rpx auto;
		background: #ab61ff;
		border-radius: 40rpx;
		border: 0;
		color: #fff;

		&.u-hairline-border:after {
			border: 0;
		}
	}

	.word {
		font-size: 36rpx;
		color: #0d1d36;
		font-weight: bold;
	}

	.qtsm {
		display: flex;
		align-items: center;

		.hz {
			color: #0D1D36;
			font-size: 30rpx;
			margin-left: 15rpx;
		}
	}

	.zwpj {
		width: 690rpx;
		height: 260rpx;
		background-color: #F5F5F9;
		margin-top: 40rpx;
		font-size: 30rpx;
		color: #F5F5F9;
		border-radius: 10rpx;
		line-height: 44rpx;
	}
</style>
